﻿using System;
using System.Collections.Generic;
using System.Text;
using MySql.Data.MySqlClient;
using System.Data;

namespace Stone.Data.MySql
{
    public sealed class MySqlClientUtils
    {
        public static MySqlParameter CreateParameter(string parameterName, MySqlDbType dbType, object value)
        {
            MySqlParameter param = new MySqlParameter(parameterName, dbType);
            param.Value = value;
            return param;
        }


        public static MySqlParameter CreateParameter(string parameterName, MySqlDbType dbType, int size, object value)
        {
            MySqlParameter param = new MySqlParameter(parameterName, dbType, size);
            param.Value = value;
            return param;
        }

        public static MySqlParameter CreateOutParameter(string parameterName, MySqlDbType dbType, int size)
        {
            MySqlParameter param = new MySqlParameter(parameterName, dbType, size);
            param.Direction = ParameterDirection.Output;
            return param;
        }

        public static MySqlParameter CreateInOutParameter(string parameterName, MySqlDbType dbType, int size, object value)
        {
            MySqlParameter param = new MySqlParameter(parameterName, dbType, size);
            param.Direction = ParameterDirection.InputOutput;
            param.Value = value;
            return param;
        }

    }
}
